package cn.zswltech.gruul.common.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JSONUtil {
    private final static Logger logger = LoggerFactory.getLogger(JSONUtil.class);

    public static JSONArray parseArray(String str) {
        try {
            if (StringUtils.isBlank(str)) {
                return null;
            }
            return JSON.parseArray(str);
        } catch (Exception e) {
            logger.error("JSON参数解析失败", e);
            logger.error("无效参数:", str);
        }
        return null;
    }
}
